Prototype int GetTrack(struct IOStdReq *ioreq, int track);
Prototype int CheckChanged(struct IOExtTD *ioreq, UNIT *unit);
Prototype int DevCloseDown(DEV *dev);
Prototype int CheckRequest(struct IOExtTD *ioreq, UNIT *unit);
Prototype UNIT *UnitInit(DEV *dev, ulong UnitNr, ulong Flags);
Prototype int UnitCloseDown(DEV *dev, UNIT *unit);
Prototype __geta4 void DiskChangeHandler(__A1 UNIT *unit);
Prototype void DiskChangeHandler0(void);
#ifndef READONLY
Prototype word CalculateGapLength(int sectors);
Prototype int ObtainRawBuffer(DEV *dev, UNIT *unit);
Prototype void FreeRawBuffer(DEV *dev);
Prototype void Internal_Update(struct IOStdReq *ioreq, UNIT *unit);
Prototype __stkargs void EncodeTrack(byte *TrackBuffer, byte *Rawbuffer, word *Crcs, long Cylinder, long Side, long GapLen, long NumSecs, long WriteLen);
/* should become ... word Cylinder, word Side, word GapLen, word NumSecs */
#endif
__stkargs word DataCRC(byte *buffer);
__stkargs void IndexIntCode(void);
__stkargs void DskBlkIntCode(void);
struct tasksig;
int HardwareCommon(DEV *dev, UNIT *unit, struct tasksig *tasksig);
int HardwareRead(DEV *dev, UNIT *unit, struct IOStdReq *ioreq);
int HardwareWrite(DEV *dev, UNIT *unit, struct IOStdReq *ioreq);
int DecodeTrack(DEV *dev, UNIT *unit);
__stkargs word DecodeTrack0(DEV *dev, UNIT *unit);
__stkargs void SafeEnableICR(long bits);
byte DecodeByte(byte *mfmdecode, word mfm);
extern __far struct Custom custom;
extern __far struct CIA ciab;
struct DiskResource *DRResource;/* Argh! A global variable! */
void *CiaBResource; /* And yet another! */
/*-
* The high clock bit in this table is still 0, but it could become
* a 1 if the two adjecent data bits are both 0.
* In fact, that is the principle of MFM clock bits: make sure that no
* two 1 bits are adjecent, but not too many (more than 3) 0 bits either.
* So, 0 c 0 -> 0 1 0 (where c is a clock bit to be determined)
* 0 c 1 -> 0 0 1
* 1 c 0 -> 1 0 0
* 1 c 1 -> 1 0 1
* The sync pattern, $4489, is %0100 0100 1000 1001
* ~ ~ ~ ~ ~ ~ ~ ~ -> %1010 0001 -> $A1
* also follows the rules, but won't be formed by encoding $A1...
* Since the bytes are written high bit first, the unknown clock bit
* (for encoded nybbles 0-7, high bit 0) will become a 1 if the preceding
* byte was even (with low bit 0).
* So, the clock bit is the NOR of the two data bits.